package activities;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import authorization.IAuthorization.Site;

import com.mga.wheelcommunity.R;

public class LoginActivity extends Activity implements OnClickListener {
	public static String ACCESS_TOKEN = "access_token";
	public static String USER_ID = "user_id";
	public static String PREF_FILE = "wc_pref";

	ImageButton vkBtn, fbBtn, gBtn;
	Button login;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.login);
			
		vkBtn = (ImageButton) findViewById(R.id.ibtnVK);
		vkBtn.setOnClickListener(this);

		fbBtn = (ImageButton) findViewById(R.id.ibtnFB);
		fbBtn.setOnClickListener(this);

		gBtn = (ImageButton) findViewById(R.id.ibtnGoogle);
		gBtn.setOnClickListener(this);

		login = (Button) findViewById(R.id.btnLogin);
		login.setOnClickListener(this);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.login, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		Intent i = new Intent();
		i.setClass(getApplicationContext(), WebActivity.class);

		switch (v.getId()) {
		case R.id.ibtnVK:
			i.putExtra("network", String.valueOf(Site.vkontakte.ordinal()));
			break;

		case R.id.ibtnFB:
			i.putExtra("network", String.valueOf(Site.facebook.ordinal()));
			break;

		case R.id.ibtnGoogle:
			i.putExtra("network", String.valueOf(Site.google.ordinal()));
			break;
		case R.id.btnLogin:
			i.setClass(getApplicationContext(), DrawerActivity.class);
		default:
			break;
		}

		startActivity(i);
		finish();
	}

}
